home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 7170 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.7 KB

  1. Path: rcp6.elan.af.mil!rscernix!danpop
  2. From: danpop@mail.cern.ch (Dan Pop)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Weird Problem with arrays
  5. Date: 15 Feb 96 12:00:20 GMT
  6. Organization: CERN European Lab for Particle Physics
  7. Distribution: inet
  8. Message-ID: <danpop.824385620@rscernix>
  9. References: <4fr2ad$8ch@metro.usyd.edu.au>
  10. NNTP-Posting-Host: ues5.cern.ch
  11. X-Newsreader: NN version 6.5.0 #7 (NOV)
  12.  
  13. In <4fr2ad$8ch@metro.usyd.edu.au> bernardd@wr.com.au (Bernard Doyle) writes:
  14.  
  15. #define far    /* to make the article suitable for c.l.c :-) */
  16.  
  17. >I am currently writing a program running under MS-DOS that has a lot of 
  18. >character arrays - about 100 kilobytes worth. These are declared globally 
  19. >as :-
  20. >
  21. >char far example[750][20];
  22. >
  23. >and are initialised by reading in a text file when the program starts up.
  24. >These arrays are all needed throughout the program. 
  25. >
  26. >A strange problem has occurred (although it may not be strange to someone
  27. >more knowledgeable than myself). 
  28. >
  29. >I have a number of other global variables not declared as far. Recently I 
  30. >changed one of these variables from an int to an integer array, (and also 
  31. >changed all references to the variable in the program to reflect this of 
  32. >course). However, now at least one of the character arrays appears to have
  33. >been corrupted by this action. Specifically when I search it, it doesn't
  34. >seem to contain the data that it should.
  35. >
  36. >Why is this happening and is there a solution? 
  37.  
  38. In the process of modifying the code you have either introduced a bug
  39. or exposed an existing bug which didn't manifest itself before the
  40. changes.
  41.  
  42. The solution is to find the bug and fix it :-)
  43.  
  44. Dan
  45. --
  46. Dan Pop
  47. CERN, CN Division
  48. Email: danpop@mail.cern.ch 
  49. Mail:  CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland
  50.